package cn.tedu.sp04.fegin;

import cn.tedu.sp01.pojo.Item;
import cn.tedu.web.util.JsonResult;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
@Component
public class ItemClientFB implements ItemClient {

    @Override
    public JsonResult<List<Item>> getItem(String orderId) {
        List<Item> list=new ArrayList<>();
        if (Math.random()<0.5){
            list.add(new Item(1,"ds",1));
            list.add(new Item(2,"op",2));
            list.add(new Item(3,"om",3));
            return JsonResult.ok().data(list);
        }
        return JsonResult.err("no").msg("shibai");

    }

    @Override
    public JsonResult<?> decreaseNumber(List<Item> items) {
        return JsonResult.err("dec fall").msg("no up");
    }
}
